﻿@{
    Layout = "~/Views/Shared/_FormWhite.cshtml";
}

<div class="wrapper animated fadeInRight">
    <form id="form" class="form-horizontal m">
        <div class="form-group">
            <label class="col-sm-2 control-label ">银行代码<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="bankID" col="BankID" type="text" class="form-control" />
            </div>
        </div>
            <label class="col-sm-2 control-label ">银行地址<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="address" col="Address" type="text" class="form-control" />
            </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">创建日期时间<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="creatDate" col="CreatDate" type="date" class="form-control" />
            </div>
        </div>
            <label class="col-sm-2 control-label ">删除标记<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="deleteFlag" col="DeleteFlag" type="checkbox" class="form-control"  style="zoom: 65 %; "/>
            </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">银行名称<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="bankName" col="BankName" type="text" class="form-control" />
            </div>
        </div>
            <label class="col-sm-2 control-label ">电话号码<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="telphoneNumber" col="TelphoneNumber" type="text" class="form-control" />
            </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">创建者<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="creator" col="Creator" type="text" class="form-control" />
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    var id = ys.request("id");
    $(function () {
        getForm();

        $('#form').validate({
            rules: {
                bankID: { required: true }
            }
        });
    });

    function getForm() {
        if (id > 0) {
            ys.ajax({
                url: '@Url.Content("~/TestManage/Bank/GetFormJson")' + '?id=' + id,
                type: 'get',
                success: function (obj) {
                    if (obj.Tag == 1) {
                        $('#form').setWebControls(obj.Data);
                    }
                }
            });
        }
        else {
            var defaultData = {};
            $('#form').setWebControls(defaultData);
        }
    }

    function saveForm(index) {
        if ($('#form').validate().form()) {
            var postData = $('#form').getWebControls({ Id: id });
            ys.ajax({
                url: '@Url.Content("~/TestManage/Bank/SaveFormJson")',
                type: 'post',
                data: postData,
                success: function (obj) {
                    if (obj.Tag == 1) {
                        ys.msgSuccess(obj.Message);
                        parent.searchGrid();
                        parent.layer.close(index);
                    }
                    else {
                        ys.msgError(obj.Message);
                    }
                }
            });
        }
    }
</script>

